package dao.impl;

import dao.LabelDao;
import domain.Category;
import domain.Label;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import util.JDBCUtils;

import java.util.List;

/**
 * @author: 爱学Java 不想秃头的 KK
 * @date: 2023/7/5 20:47
 * @version: 1.0
 * @Created with IntelliJ IDEA.
 * @Description:
 */
public class LabelDaoImpl implements LabelDao {
    private JdbcTemplate template = new JdbcTemplate(JDBCUtils.getDataSource());

    @Override
    public List<Label> findAll() {
        String sql = "select * from tab_label";
        return template.query(sql,new BeanPropertyRowMapper<Label>(Label.class));
    }
}
